package org.rcy.framework.thrift.metadata;

import org.apache.thrift.TFieldIdEnum;

public class FieldIdEnum implements TFieldIdEnum, Comparable<FieldIdEnum> {

	private short fieldId;
	private String fieldName;

	public FieldIdEnum(short fieldId, String fieldName) {
		super();
		this.fieldId = fieldId;
		this.fieldName = fieldName;
	}

	@Override
	public short getThriftFieldId() {
		return fieldId;
	}

	@Override
	public String getFieldName() {
		return fieldName;
	}

	@Override
	public int compareTo(FieldIdEnum other) {
		return this.fieldId - other.fieldId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + fieldId;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		FieldIdEnum other = (FieldIdEnum) obj;
		if (fieldId != other.fieldId) {
			return false;
		}
		return true;
	}

}